import React from "react";
import store from "@/store"
import { setMovieList } from "@/store/actions/movieAction";
export default function Movie(){
  console.log(store.getState());
  return (
    <div>
      <h2>Movie</h2>
      <h3>Count的值是：{store.getState().count}</h3>
      <button onClick={()=>{
        store.dispatch(setMovieList())
      }}>获取最新的电影列表(发送一个ajax请求,得到新的数据,设置给redux的数据上)</button>


    <ul>
      {
        store.getState().movie.movieList.map((item)=>{
              return <li key={item.tvId}>
                <h3>{item.title}</h3>
                
                  <img src={item.imageUrl} alt=""/>
                
                <p>
                  {item.description}
                </p>
              </li>
        })
      }
    </ul>
    </div>
  )
}